<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'north'" class="center">
        <div class="webmap">
            <p class="webmaptip">当前位置:</p>
            <a href="javascript:goHome();" class="easyui-link">系统管理</a>
            <p class="webmaptip">></p>
            <a href="javascript:;" class="easyui-link">协议书管理</a>
        </div>
        <div class="querybycon">
            <form id="query">
                <div class="queryinfo">
                    <div>标题<input type="text" name="title"></div>
                    <div>类型 <input class="easyui-combobox"
                                   name="category"
                                   data-options="url:'/dictionary/agreementType'"></div>
                    <div><a id="querybtn" href="javascript:;" class="easyui-linkbutton info"
                            data-options="iconCls:'fa fa-search'">查询</a></div>
                </div>
            </form>
        </div>
        <div class="separator"></div>
        <div class="querybtn">
            <a id="add" href="javascript:;" class="easyui-linkbutton  warning"
               data-options="iconCls:'fa fa-plus'">增加</a>
            <a id="edit" href="javascript:;" class="easyui-linkbutton danger"
               data-options="iconCls:'fa fa-pencil'">编辑</a>
            <a href="javascript:;" class="easyui-linkbutton info preview"
               data-options="iconCls:'fa fa-search'">预览</a>

        </div>


    </div>

    <div data-options="region:'center'">
        <table id="list"></table>
    </div>
</div>

<script type="text/javascript">

    var addUrl = "page/agreement/agreementadd.html";
    var editUrl = "page/agreement/agreementedit.html";
    var delUrl = '/agreement/del';
    var save = '/agreement/save';
    var listUrl = "/agreement/list";
    var edit = "/agreement/edit";
    var columns = [[{
        field: 'id',
        checkbox: true
    }
        , {
            field: 'title',
            title: '标题'
        }

        , {
            field: 'category',
            title: '类型', formatter: function (value) {
                return dic["agreementType"][value.toString()];
            }
        }

        , {
            field: 'description',
            title: '描述'
        }

        , {
            field: 'createdDate',
            title: '录入时间'
        }

        , {
            field: 'publishTime',
            title: '发布时间'
        }, {
            field: 'state',
            title: '状态', formatter: function (value) {
                return dic["pubStatusType"][value.toString()];
            }
        }
    ]];
    list.init({url: listUrl, columns: columns});
    //预览
    $(".preview").click(function () {
        var rows = $("#list").datagrid('getChecked');
        if (rows.length != 1) {
            $.messager.alert('操作提示', '请选择一行数据', 'info');
            $("#list").datagrid('uncheckAll');
            return false;
        } else {
            window.open("http://192.168.1.187:3100/agreement/website_service_protocal");
        }
    });
</script>
